package c.e.a.b.a.a;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.pm.PackageManager.NameNotFoundException;
import android.util.Log;
import c.e.a.b.b.e;

public final class c {
    public SharedPreferences a;

    public c(Context context) {
        try {
            SharedPreferences sharedPreferences;
            boolean z = e.a;
            try {
                context = context.createPackageContext("com.google.android.gms", 3);
            } catch (NameNotFoundException unused) {
                context = null;
            }
            if (context == null) {
                sharedPreferences = null;
            } else {
                sharedPreferences = context.getSharedPreferences("google_ads_flags", 0);
            }
            this.a = sharedPreferences;
        } catch (Throwable th) {
            Log.w("GmscoreFlag", "Error while getting SharedPreferences ", th);
            this.a = null;
        }
    }

    public final boolean a(String str) {
        try {
            SharedPreferences sharedPreferences = this.a;
            return sharedPreferences == null ? false : sharedPreferences.getBoolean(str, false);
        } catch (Throwable th) {
            Log.w("GmscoreFlag", "Error while reading from SharedPreferences ", th);
            return false;
        }
    }
}
